import { FC } from 'react';
import { Outlet } from 'react-router-dom';
import { setUserInfo } from '@/store/features/user';
import { useSelector } from 'react-redux';
import { AppState } from '@/store';
import { useTypeDispatch } from '@/store/hook';
import { ConfigProvider } from 'antd';
export const Root: FC = () => {
  const b = useSelector((state: AppState) => state.user.userInfo);
  const dispatch = useTypeDispatch();
  // useEffect(() => {
  //   getPaper({ id: 1 }).then((res) => {
  //     res.name;
  //   });
  // }, []);
  const handleClick = () => {
    dispatch(setUserInfo({ name: 'song' }));
  };
  return (
    <>
      <div>
        {JSON.stringify(b)}
        <button onClick={handleClick}>按钮</button>
        <div className='left'>
          <a href='/contact/1'>left-1</a>
          <a href='/contact/2'>left-2</a>
        </div>
        <div className='right'>
          <ConfigProvider theme={{ token: { colorPrimary: '#333' } }}>
            <Outlet />
          </ConfigProvider>
        </div>
      </div>
    </>
  );
};
